home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_libgtop.idb / usr / freeware / include / glibtop / error.h.z / error.h
Encoding:
C/C++ Source or Header  |  1999-07-16  |  3.1 KB  |  128 lines

  1. /* $Id: error.h,v 1.11 1999/02/23 11:42:51 martin Exp $ */
  2.  
  3. /* Copyright (C) 1998-99 Martin Baulig
  4.    This file is part of LibGTop 1.0.
  5.  
  6.    Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
  7.  
  8.    LibGTop is free software; you can redistribute it and/or modify it
  9.    under the terms of the GNU General Public License as published by
  10.    the Free Software Foundation; either version 2 of the License,
  11.    or (at your option) any later version.
  12.  
  13.    LibGTop is distributed in the hope that it will be useful, but WITHOUT
  14.    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15.    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  16.    for more details.
  17.  
  18.    You should have received a copy of the GNU General Public License
  19.    along with LibGTop; see the file COPYING. If not, write to the
  20.    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21.    Boston, MA 02111-1307, USA.
  22. */
  23.  
  24. #ifndef __GLIBTOP_ERROR_H__
  25. #define __GLIBTOP_ERROR_H__
  26.  
  27. #include <glibtop.h>
  28.  
  29. BEGIN_LIBGTOP_DECLS
  30.  
  31. void glibtop_error_vr (glibtop *server, char *format, va_list args);
  32. void glibtop_warn_vr (glibtop *server, char *format, va_list args);
  33.  
  34. void glibtop_error_io_vr (glibtop *server, char *format, int, va_list args);
  35. void glibtop_warn_io_vr (glibtop *server, char *format, int, va_list args);
  36.  
  37. static void
  38. glibtop_error_r (glibtop *server, char *format, ...)
  39. {
  40.     va_list args;
  41.  
  42.     va_start (args, format);
  43.     glibtop_error_vr (server, format, args);
  44.     va_end (args);
  45. }
  46.  
  47. static void
  48. glibtop_warn_r (glibtop *server, char *format, ...)
  49. {
  50.     va_list args;
  51.  
  52.     va_start (args, format);
  53.     glibtop_warn_vr (server, format, args);
  54.     va_end (args);
  55. }
  56.  
  57. static void
  58. glibtop_error_io_r (glibtop *server, char *format, ...)
  59. {
  60.     va_list args;
  61.  
  62.     va_start (args, format);
  63.     glibtop_error_io_vr (server, format, errno, args);
  64.     va_end (args);
  65. }
  66.  
  67. static void
  68. glibtop_warn_io_r (glibtop *server, char *format, ...)
  69. {
  70.     va_list args;
  71.  
  72.     va_start (args, format);
  73.     glibtop_warn_io_vr (server, format, errno, args);
  74.     va_end (args);
  75. }
  76.  
  77. #ifdef  __GNUC__
  78.  
  79. #define glibtop_error(p1, args...)    glibtop_error_r(glibtop_global_server , p1 , ## args)
  80. #define glibtop_warn(p1, args...)    glibtop_warn_r(glibtop_global_server , p1 , ## args)
  81.  
  82. #define glibtop_error_io(p1, args...)    glibtop_error_io_r(glibtop_global_server , p1 , ## args)
  83. #define glibtop_warn_io(p1, args...)    glibtop_warn_io_r(glibtop_global_server , p1 , ## args)
  84.  
  85. #else /* no __GNUC__ */
  86.  
  87. static void
  88. glibtop_error (char *format, ...)
  89. {
  90.     va_list args;
  91.     va_start (args, format);
  92.     glibtop_error_vr (glibtop_global_server, format, args);
  93.     va_end (args);
  94. }
  95.  
  96. static void
  97. glibtop_warn (char *format, ...)
  98. {
  99.     va_list args;
  100.     va_start (args, format);
  101.     glibtop_warn_vr (glibtop_global_server, format, args);
  102.     va_end (args);
  103. }
  104.  
  105. static void
  106. glibtop_error_io (char *format, ...)
  107. {
  108.     va_list args;
  109.     va_start (args, format);
  110.     glibtop_error_io_vr (glibtop_global_server, format, errno, args);
  111.     va_end (args);
  112. }
  113.  
  114. static void
  115. glibtop_warn_io (char *format, ...)
  116. {
  117.     va_list args;
  118.     va_start (args, format);
  119.     glibtop_warn_io_vr (glibtop_global_server, format, errno, args);
  120.     va_end (args);
  121. }
  122.  
  123. #endif /* no __GNUC__ */
  124.  
  125. END_LIBGTOP_DECLS
  126.  
  127. #endif
  128.